package com.clf.springBoot.modules.common.controller;

import com.clf.springBoot.modules.common.service.ImageService;
import com.clf.springBoot.modules.common.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: chenglongfei
 * @date: 2022/7/11
 * @Description ImageController
 */
@RestController
@RequestMapping("/api")
public class ImageController {

    @Autowired
    private ImageService imageService;

    /**
     * 127.0.0.1/api/image/profile-big ---- post
     */
    @PostMapping(value = "/image/{type}", consumes = "multipart/form-data")
    public Result<String> uploadImage(@RequestParam MultipartFile image, @PathVariable String type) {
        return imageService.uploadImage(image, type);
    }

}
